﻿#pragma once

#include <QWidget>
#include "ui_RecordingWindow.h"

// Qt 库
//#include <QFileDialog>
#include <QString>
#include <QColor>

// 自定义类
#include "FFmpegRecording.h"

class RecordingWindow : public QWidget
{
	Q_OBJECT

public:
	RecordingWindow(QWidget *parent = nullptr);
	~RecordingWindow();


signals:
	void closed();


private slots:
	void selectPathSlot();

	void inMicrophoneSlot();
	void inSpeakerSlot();
	void inBothSlot();

	void startRecordingSlot();
	void pauseRecordingSlot();
	void stopRecordingSlot();


protected:
	void closeEvent(QCloseEvent *event) override;


private:
	inline void enableSelection(bool flag);
	inline void cleanSource();

	Ui::RecordingWindowClass ui;

	QString filePath = "";
	QString fileName = "";
	QColor defaultLabelColor;
	QString buttonStyleSheet = "QPushButton {"
		"   background-color: transparent;" // 背景颜色
		"   border: 2px solid #000;" // 边框
		"   border-radius: 10px;" // 圆角
		"   padding: 0px;" // padding
		"   margin: 0px;" // margin
		"   text-align: center;" // 文字居中
		"}"
		"QPushButton:hover {"
		"   background-color: rgba(238, 130, 238, 0.8);" // 鼠标悬停状态的背景色
		"}"
		"QPushButton:checked {"
		"   background-color: pink;" // 点击状态的背景色
		"}";
	FFmpegRecording* ffmpegRecording = nullptr;

	// enum
	MyIODeviceType currentInputType = MyIODeviceType::Microphone;

	// flags
	//bool microphoneFlag = false;
	//bool speakerFlag = false;
	//bool bothFlag = false;
	bool isRecording = false;
	bool isPaused = false;
};

